
const app = getApp()
var id;

Page({
  onLoad: function (options) {
    var s = this;
    id = options.id;
    console.log(id);
  },
    data: {
        showTopTips: false,
        Name: "",
        Info: "",
        Phone: "",
        date: "2016-09-01",
        starttime: "12:00",
        endtime: "13:40",
        isAgree: false
    },
    nameInput: function (e) {
      this.setData({
        Name: e.detail.value
      })
    },
    phoneInput: function (e) {
      this.setData({
        Phone: e.detail.value
      })
    },
    infoInput: function (e) {
      this.setData({
        Info: e.detail.value
      })
    },
    bindDateChange: function (e) {
        this.setData({
            date: e.detail.value
        })
    },
    startTimeChange: function (e) {
        this.setData({
            starttime: e.detail.value
        })
    },
    endTimeChange: function (e) {
      this.setData({
            endtime: e.detail.value
      })
    },
    
    showTopTips: function (e) {
      console.log(this.data.Info);
      wx.request({
        url: app.data.url+'/addRequest', //仅为示例，并非真实的接口地址
        
        data: {
          name:this.data.Name,
          username: app.globalData.userInfo,
          phone: this.data.Phone,
          date: this.data.date,
          startTime: this.data.starttime,
          endTime: this.data.endtime,
          info: this.data.Info,
          ID: id,
        },
        method: "POST",
        header: {
          'content-type': 'application/x-www-form-urlencoded' // 默认值
        },
        success: function (res) {
          console.log(res);
        }
        
      })
      wx.navigateTo({
        url: '../msg/msg_success'
      })
    },
}); 